Module Expr Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str ImportFrom alias alias alias FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore IfExp NameLoad Call NameLoad NameLoad keyword NameLoad Dict Assign NameStore Dict For NameStore NameLoad body Assign SubscriptStore NameLoad Index NameLoad Call NameLoad GeneratorExp NameLoad comprehension TupleStore NameStore NameStore Call AttributeLoad NameLoad attr CompareIn BinOpAdd NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad NameLoad NameLoad For NameStore NameLoad body For NameStore SubscriptLoad NameLoad Index NameLoad body If CompareNotIn NameLoad SubscriptLoad NameLoad Index NameLoad body Expr Call NameLoad BinOpAdd NameLoad NameLoad NameLoad NameLoad For NameStore SubscriptLoad NameLoad Index NameLoad body If CompareNotIn NameLoad SubscriptLoad NameLoad Index NameLoad body Expr Call NameLoad BinOpAdd NameLoad NameLoad NameLoad NameLoad decorator_list
N/A N/A  Permissions utility functions  N/A __author__ George Karakostas N/A __copyright__ Copyright 2015, George Karakostas N/A __licence__ BSD-3 N/A __email__ gkarak@9-dev.com guardian.shortcuts get_groups_with_perms assign_perm remove_perm get_perms N/A N/A obj fields suffix N/A N/A N/A  Get all groups which have perms on an object, categorized by permission names (fields)
    To be mainly used in form operations to obtain the initial value of fields
    The guardian `get_groups_with_perms()` returns a dictionary of groups, with relevant permissions
    The list comprehension statement below hecks if the field is in the dict, and appends the group

    :param obj: the record object for which to get permissions
    :param fields: the permission names to categorize
    :param suffix: an additional string that, when appended on the field name, will give us the perm name
    :return: a dictionary of fields: groups list
     N/A groups N/A obj N/A get_groups_with_perms obj attach_perms True N/A N/A perms N/A N/A field fields N/A N/A N/A perms N/A field N/A list N/A key N/A N/A key val N/A N/A groups items N/A N/A field suffix val N/A perms N/A set_perms N/A N/A obj fields suffix perms N/A N/A N/A  Set group perms on an object
    To be mainly used in form operations, from which the cleaned data of fields are obtained
    Check if group is in new perms and not in old, and assign, or vice versa

    :param obj: the record object for which to get permissions
    :param fields: the permission names to categorize
    :param suffix: an additional string that, when appended on the field name, will give us the perm name
    :param perms:
    :return: a dictionary of fields: groups list
     N/A old_perms N/A get_perms obj fields suffix N/A field fields N/A N/A group N/A perms N/A field N/A N/A N/A group N/A old_perms N/A field N/A N/A N/A assign_perm N/A field suffix group obj N/A group N/A old_perms N/A field N/A N/A N/A group N/A perms N/A field N/A N/A N/A remove_perm N/A field suffix group obj N/A