Example #1
0
    stub = InterfaceReadProperty
    name = InterfaceReadProperty

    in_agent = InterfaceReadProperty

class ResourceEditor :
    title = InterfaceWriteProperty
    description = InterfaceWriteProperty
    author = InterfaceWriteProperty
    license = InterfaceWriteProperty
    resource = InterfaceWriteProperty
    
class ResourceManager :
    delete = InterfaceCallProperty

from apps.plus_permissions.models import add_type_to_interface_map
ResourceInterfaces = {
    'Viewer': ResourceViewer,
    'Editor': ResourceEditor,
    'Manager' : ResourceManager  }
add_type_to_interface_map(Resource, ResourceInterfaces)

if not SliderOptions.get(Resource, False):
    SetSliderOptions(Resource, {'InterfaceOrder':['Viewer', 'Editor', 'Manager'], 'InterfaceLabels':{}})

child_types = []
SetPossibleTypes(Resource, child_types)
SetTypeLabels(content_type, 'Upload')

Example #2
0
    stub = InterfaceWriteProperty

class WikiPageCreator:
    created_by = InterfaceWriteProperty

class WikiPageDelete:
    delete = InterfaceCallProperty

class WikiPageCommentor: 
    comment = InterfaceCallProperty


class WikiPageCommentReader:
    view_comments = InterfaceReadProperty

if not get_interface_map(WikiPage):
    WikiPageInterfaces = {'Viewer':WikiPageViewer,
                          'Editor':WikiPageEditor,
                          'Delete':WikiPageDelete,
                          'Creator':WikiPageCreator,
                          "Commentor":WikiPageCommentor,
                          "ViewComments":WikiPageCommentReader}

    add_type_to_interface_map(content_type, WikiPageInterfaces)

if not SliderOptions.get(WikiPage, False):
    SetSliderOptions(WikiPage, {'InterfaceOrder':['Viewer', 'Editor','Commentor', 'ManagePermissions'], 'InterfaceLabels':{'Viewer':'View', 'Editor':'Edit', 'Commentor':'Comment', 'ManagePermissions':'Change Permissions'}})



Example #3
0
    author = InterfaceWriteProperty

class WikiPageCreator:
    created_by = InterfaceWriteProperty

class WikiPageManager:
    delete = InterfaceCallProperty
    move_to_new_group = InterfaceCallProperty

class WikiPageCommentor: 
    comment = InterfaceCallProperty

class WikiPageCommentViewer:
    view_comments = InterfaceReadProperty

if not get_interface_map(WikiPage):
    WikiPageInterfaces = {'Viewer':WikiPageViewer,
                          'Editor':WikiPageEditor,
                          'Manager':WikiPageManager,
                          'Creator':WikiPageCreator,
                          "Commentor":WikiPageCommentor,
                          "ViewComments":WikiPageCommentViewer}

    add_type_to_interface_map(content_type, WikiPageInterfaces)

if not SliderOptions.get(WikiPage, False):
    SetSliderOptions(WikiPage, {'InterfaceOrder':['Viewer', 'Editor','Commentor', 'Manager', 'ManagePermissions'], 'InterfaceLabels':{'Viewer':'View', 'Editor':'Edit', 'Commentor':'Comment', 'Manager':'Manage (Move / Delete)', 'ManagePermissions':'Change Permissions'}})



Example #4
0
class ResourceDelete:
    delete = InterfaceCallProperty


from apps.plus_permissions.models import add_type_to_interface_map
ResourceInterfaces = {
    'Viewer': ResourceViewer,
    'Editor': ResourceEditor,
    'Commentor': ResourceCommentor,
    'Delete': ResourceDelete,
    'Manager': ResourceManager,
}
add_type_to_interface_map(Resource, ResourceInterfaces)

if not SliderOptions.get(Resource, False):
    SetSliderOptions(
        Resource, {
            'InterfaceOrder': ['Viewer', 'Editor', 'Commentor', 'Manager'],
            'InterfaceLabels': {
                'Viewer': 'View',
                'Editor': 'Edit',
                'Commentor': 'Comment',
                'Manager': 'Manage (Move / Delete)',
                'ManagePermissions': 'Change Permissions'
            }
        })

child_types = []
SetPossibleTypes(Resource, child_types)
SetTypeLabels(content_type, 'Upload')
Example #5
0
        'Join': TgGroupJoin,
        'Leave': TgGroupLeave,
        'Commentor': TgGroupComment,
        'Uploader': TgGroupUploader,
        'Message': TgGroupMessage,
        'Invite': TgGroupInvite,
        'GroupTypeEditor': TgGroupTypeEditor,
        'StatusViewer': TgGroupStatusViewer,
        'SetManagePermissions': SetManagePermissions
    }
    add_type_to_interface_map(TgGroup, TgGroupInterfaces)

# use InterfaceOrder to draw the slider and constraints, these are used in rendering the sliders and in validating the results
# these exist on a per type basis and are globals for their type.
# they don't need to be stored in the db
if not SliderOptions.get(TgGroup, False):
    SetSliderOptions(
        TgGroup, {
            'InterfaceOrder': [
                'Viewer', 'Editor', 'Join', 'Uploader', 'Commentor', 'Invite',
                'Message', 'ManageMembers', 'Delete', 'ManagePermissions'
            ],
            'InterfaceLabels': {
                'Viewer': 'View',
                'Editor': 'Edit',
                'Commentor': 'Comment',
                'Message': 'Message Group',
                'ManageMembers': 'Manage Membership',
                'ManagePermissions': 'Change Permissions'
            }
        })
Example #6
0
if not get_interface_map(TgGroup):
    TgGroupInterfaces = {'Viewer': TgGroupViewer,
                         'Editor': TgGroupEditor,
                         'Invite': TgGroupInviteMember,
                         'ManageMembers': TgGroupManageMembers,
                         'Join': TgGroupJoin,
                         'Comment':TgGroupComment,
                         'Uploader':TgGroupUploader,
                         'SetManagePermissions':SetManagePermissions}
    add_type_to_interface_map(TgGroup, TgGroupInterfaces)


# use InterfaceOrder to draw the slider and constraints, these are used in rendering the sliders and in validating the results
# these exist on a per type basis and are globals for their type.
# they don't need to be stored in the db
if not SliderOptions.get(TgGroup, False):
    SetSliderOptions(TgGroup, {'InterfaceOrder':['Viewer', 'Editor', 'Invite', 'Join', 'Uploader', 'ManageMembers', 'ManagePermissions'], 
                               'InterfaceLabels':{'Viewer':'View',
                                                  'Editor': 'Edit',
                                                  'ManageMembers': 'Manage Membership',
                                                  'ManagePermissions':'Change Permissions'}})


# ChildTypes are used to determine what types of objects can be created in this security context (and acquire security context from this). These are used when creating an explicit security context for an object of this type. 
if TgGroup not in PossibleTypes:
    child_types = [OurPost, Site, Application, Contact, Profile, WikiPage, Link, Resource]
    SetPossibleTypes(TgGroup, child_types)
    SetVisibleTypes(content_type, [TgGroup, WikiPage, Resource, Application])
    SetTypeLabels(content_type, 'Group')

# if the security context is in this agent, this set of slider_agents apply, irrespective of the type of resource they are