def get(self, exploration_id): """Gets the user permissions for an exploration.""" exploration_rights = rights_manager.get_exploration_rights( exploration_id) self.values.update({ 'can_delete': rights_manager.check_can_delete_activity(self.user, exploration_rights), 'can_edit': rights_manager.check_can_edit_activity(self.user, exploration_rights), 'can_modify_roles': (rights_manager.check_can_modify_core_activity_roles( self.user, exploration_rights)), 'can_publish': rights_manager.check_can_publish_activity(self.user, exploration_rights), 'can_release_ownership': (rights_manager.check_can_release_ownership( self.user, exploration_rights)), 'can_voiceover': (rights_manager.check_can_voiceover_activity( self.user, exploration_rights)), 'can_unpublish': rights_manager.check_can_unpublish_activity( self.user, exploration_rights), 'can_manage_voice_artist': rights_manager.check_can_manage_voice_artist_in_activity( self.user, exploration_rights), }) self.render_json(self.values)
def test_check_cannot_modify_activity_roles_with_no_activity_rights(self): self.assertFalse( rights_manager.check_can_modify_core_activity_roles( self.owner, None))