#96 实现组内的任何一个人都可以分享内容到这个组中.

存在不足:共享内容以分享者进行归类组织.  更好的内容组织方式:共享给组的以组归类组织,共享给个人的以分享者个人组织
This commit is contained in:
Refactoring
2015-03-30 20:19:48 +08:00
parent 0f7ebb6c53
commit e186cf984c
2 changed files with 35 additions and 10 deletions

View File

@ -666,8 +666,7 @@ func (this *ShareService) HasReadNotePerm(noteId, userId string) bool {
// 得到笔记分享给的groups
func (this *ShareService) GetNoteShareGroups(noteId, userId string) []info.ShareNote {
// 得到分组s
groups := groupService.GetGroups(userId)
groups := groupService.GetGroupsContainOf(userId)
// 得到有分享的分组
shares := []info.ShareNote{}
@ -694,9 +693,7 @@ func (this *ShareService) GetNoteShareGroups(noteId, userId string) []info.Share
// 共享笔记给分组
func (this *ShareService) AddShareNoteGroup(userId, noteId, groupId string, perm int) (bool) {
// 得到group, 是否是我的group
group := groupService.GetGroup(userId, groupId)
if group.GroupId == "" {
if !groupService.IsExistsGroupUser(userId, groupId) {
return false
}
@ -724,8 +721,7 @@ func (this *ShareService) DeleteShareNoteGroup(userId, noteId, groupId string) b
// 得到笔记本分享给的groups
func (this *ShareService) GetNotebookShareGroups(notebookId, userId string) []info.ShareNotebook {
// 得到分组s
groups := groupService.GetGroups(userId)
groups := groupService.GetGroupsContainOf(userId)
// 得到有分享的分组
shares := []info.ShareNotebook{}
@ -752,9 +748,7 @@ func (this *ShareService) GetNotebookShareGroups(notebookId, userId string) []in
}
// 共享笔记给分组
func (this *ShareService) AddShareNotebookGroup(userId, notebookId, groupId string, perm int) (bool) {
// 得到group, 是否是我的group
group := groupService.GetGroup(userId, groupId)
if group.GroupId == "" {
if !groupService.IsExistsGroupUser(userId, groupId) {
return false
}