Esempio n. 1
0
    cc_messages_to_email = InterfaceWriteProperty
    change_avatar = InterfaceCallProperty


from apps.plus_permissions.models import add_type_to_interface_map

ProfileInterfaces = {
    'Viewer': ProfileViewer,
    'Editor': ProfileEditor,
    'EmailAddressViewer': ProfileEmailAddressViewer,
    'HomeViewer': ProfileHomeViewer,
    'WorkViewer': ProfileWorkViewer,
    'MobileViewer': ProfileMobileViewer,
    'FaxViewer': ProfileFaxViewer,
    'AddressViewer': ProfileAddressViewer,
    'SkypeViewer': ProfileSkypeViewer,
    'SipViewer': ProfileSipViewer
}

add_type_to_interface_map(Profile, ProfileInterfaces)

SliderOptions = {
    'InterfaceOrder': ['Viewer'],
    'InterfaceLabels': {
        'Viewer': 'View',
        'Editor': 'Edit'
    }
}
SetSliderOptions(Profile, SliderOptions)
Esempio n. 2
0
    delete = InterfaceCallProperty


class ApplicationReject:
    pk = InterfaceReadProperty
    reject = InterfaceCallProperty
    delete = InterfaceCallProperty


from apps.plus_permissions.models import add_type_to_interface_map

ApplicationInterfaces = {
    'Viewer': ApplicationViewer,
    'Editor': ApplicationEditor,
    'Accept': ApplicationAccept,
    'Reject': ApplicationReject,
}

add_type_to_interface_map(Application, ApplicationInterfaces)

# 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
SliderOptions = {'InterfaceOrder': ['Viewer', 'Editor', 'Accept', 'Reject']}
SetSliderOptions(Application, SliderOptions)

# 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.

child_types = []
SetPossibleTypes(Application, child_types)
Esempio n. 3
0
    pass


UserInterfaces = {
    'Viewer': UserViewer,
    'SetManagePermissions': SetManagePermissions,
    'Editor': UserEditor,
}

add_type_to_interface_map(User, UserInterfaces)

# 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
SliderOptions = {'InterfaceOrder': [], 'InterfaceLabels': {}}
SetSliderOptions(User, SliderOptions)


# if the security context is in this agent, this set of slider_agents apply, irrespective of the type of resource they are
def get_slider_agents(scontext):
    return [('anonymous_group', get_anonymous_group().get_ref()),
            ('all_members_group', get_all_members_group().get_ref()),
            ('context_agent', scontext.context_agent),
            ('context_admin', scontext.context_admin)]


def visible_agents():
    return ['anonymous_group', 'all_members_group', 'context_agent']


SetVisibleAgents(User, visible_agents())
Esempio n. 4
0
from apps.plus_feed.models import FeedItem
from apps.plus_permissions.models import add_type_to_interface_map

content_type = FeedItem
child_types = []

class FeedItemViewer :
    id = InterfaceReadProperty
    short = InterfaceReadProperty
    expanded = InterfaceReadProperty
    external_link = InterfaceReadProperty
    type = InterfaceReadProperty
    target = InterfaceReadProperty
    source = InterfaceReadProperty
    sent = InterfaceReadProperty
    has_avatar = InterfaceCallProperty

UserInterfaces = {
    'Viewer' : FeedItemViewer,
    }

add_type_to_interface_map(FeedItem, UserInterfaces)

SliderOptions = {'InterfaceOrder':['Viewer'], 
                 'InterfaceLabels':{'Viewer':'View'}}

SetSliderOptions(FeedItem, SliderOptions)


Esempio n. 5
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'}})



Esempio n. 6
0
    pk = InterfaceReadWriteProperty
    invited = InterfaceReadWriteProperty
    invited_by = InterfaceReadWriteProperty
    group = InterfaceReadWriteProperty
    message = InterfaceReadWriteProperty
    status = InterfaceReadWriteProperty
    date = InterfaceReadWriteProperty
    is_site_invitation = InterfaceCallProperty


class MemberInviteAccept():
    pk = InterfaceReadProperty
    accept = InterfaceCallProperty
    make_accept_url = InterfaceCallProperty
    status = InterfaceReadWriteProperty
    accepted_by = InterfaceReadWriteProperty
    delete = InterfaceCallProperty


from apps.plus_permissions.models import add_type_to_interface_map
MemberInviteInterfaces = {
    'Viewer': MemberInviteViewer,
    'Editor': MemberInviteEditor,
    'Accept': MemberInviteAccept
}
add_type_to_interface_map(MemberInvite, MemberInviteInterfaces)
SliderOptions = {'InterfaceOrder': ['Viewer', 'Editor', 'Accept']}
SetSliderOptions(MemberInvite, SliderOptions)
child_types = []
SetPossibleTypes(MemberInvite, child_types)
Esempio n. 7
0
from apps.plus_permissions.models import SetSliderOptions, SetAgentDefaults, SetPossibleTypes, \
    SetSliderAgents, SetVisibleAgents, SetVisibleTypes, PossibleTypes, SetTypeLabels

from apps.plus_permissions.models import add_type_to_interface_map

from apps.plus_feed.models import AggregateFeed

content_type = AggregateFeed
child_types = []


class AggregateFeedViewer:
    target = InterfaceReadProperty


UserInterfaces = {
    'Viewer': AggregateFeedViewer,
}

add_type_to_interface_map(AggregateFeed, UserInterfaces)

SliderOptions = {
    'InterfaceOrder': ['Viewer'],
    'InterfaceLabels': {
        'Viewer': 'View'
    }
}

SetSliderOptions(AggregateFeed, SliderOptions)
Esempio n. 8
0
    project_stage = InterfaceReadProperty
    assistance_offered = InterfaceReadProperty


class HostInfoEditor:
    find_out = InterfaceWriteProperty
    peer_mentoring = InterfaceWriteProperty
    expected_membership_benefits = InterfaceWriteProperty
    project = InterfaceWriteProperty
    project_stage = InterfaceWriteProperty
    assistance_offered = InterfaceWriteProperty


from apps.plus_permissions.models import add_type_to_interface_map

HostInfoInterfaces = {
    'Viewer': HostInfoViewer,
    'Editor': HostInfoEditor,
}

add_type_to_interface_map(HostInfo, HostInfoInterfaces)

SliderOptions = {
    'InterfaceOrder': ['Viewer'],
    'InterfaceLabels': {
        'Viewer': 'View',
        'Editor': 'Edit'
    }
}
SetSliderOptions(HostInfo, SliderOptions)
Esempio n. 9
0
class LinkEditor:
    text = InterfaceWriteProperty
    url = InterfaceWriteProperty
    target = InterfaceWriteProperty
    service = InterfaceWriteProperty


class LinkDelete:
    delete = InterfaceCallProperty


class LinkManager:
    delete = InterfaceCallProperty


from apps.plus_permissions.models import add_type_to_interface_map
LinkInterfaces = {
    'Viewer': LinkViewer,
    'Editor': LinkEditor,
    'Delete': LinkDelete,
    'Manager': LinkManager
}
add_type_to_interface_map(Link, LinkInterfaces)

SliderOptions = {'InterfaceOrder': ['Viewer', 'Manager']}
SetSliderOptions(Link, SliderOptions)

child_types = []
SetPossibleTypes(Link, child_types)
Esempio n. 10
0
        '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'
            }
        })

# 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,
        MemberInvite, AggregateFeed, FeedItem
    ]
    SetPossibleTypes(TgGroup, child_types)
Esempio n. 11
0
# Here's the wrapping we have to put around it.


class OurPostViewer:
    title = InterfaceReadProperty
    body = InterfaceReadProperty


class OurPostEditor:
    title = InterfaceWriteProperty
    body = InterfaceWriteProperty
    delete = InterfaceCallProperty


class OurPostCommentor:
    pass


from apps.plus_permissions.models import add_type_to_interface_map, get_interface_map

OurPostInterfaces = {
    'Viewer': OurPostViewer,
    'Editor': OurPostEditor,
    'Commentor': OurPostCommentor
}

add_type_to_interface_map(content_type, OurPostInterfaces)

SliderOptions = {'InterfaceOrder': ['Viewer', 'Editor', 'Commentor']}
SetSliderOptions(content_type, SliderOptions)