commit/galaxy-central: martenson: small bugfix and new method in folder manager
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/e128330d8e78/ Changeset: e128330d8e78 User: martenson Date: 2014-09-03 17:14:42 Summary: small bugfix and new method in folder manager Affected #: 1 file diff -r 3180ca1c1994705a17dedb5d6c4f8373b4f5aae4 -r e128330d8e78e3d2d7bbc5f60c7515fab9762626 lib/galaxy/managers/folders.py --- a/lib/galaxy/managers/folders.py +++ b/lib/galaxy/managers/folders.py @@ -83,7 +83,7 @@ Check whether the folder is accessible to current user. By default every folder is accessible (contents have their own permissions). """ - return True + return folder def get_folder_dict( self, trans, folder ): """ @@ -156,6 +156,19 @@ add_library_item_role_list = [ ( add_role.name, trans.security.encode_id( add_role.id ) ) for add_role in add_roles ] return dict( modify_folder_role_list=modify_folder_role_list, manage_folder_role_list=manage_folder_role_list, add_library_item_role_list=add_library_item_role_list ) + def can_add_item( self, trans, folder ): + """ + Return true if the user has permissions to add item to the given folder. + """ + if trans.user_is_admin: + return True + current_user_roles = trans.get_current_user_roles() + add_roles = set( trans.app.security_agent.get_roles_for_action( folder, trans.app.security_agent.permitted_actions.LIBRARY_ADD ) ) + for role in current_user_roles: + if role in add_roles: + return True + return False + def cut_the_prefix( self, encoded_folder_id ): """ Remove the prefix from the encoded folder id. Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org