def create_repository_admin_role(app, repository):
 sa_session = app.model.context.current
 name = get_repository_admin_role_name(str(repository.name), str(repository.user.username))
 description = 'A user or group member with this role can administer this repository.'
 role = app.model.Role(name=name, description=description, type=app.model.Role.types.SYSTEM)
 sa_session.add(role)
 sa_session.flush()
 app.model.UserRoleAssociation(repository.user, role)
 rra = app.model.RepositoryRoleAssociation(repository, role)
 sa_session.add(rra)
 sa_session.flush()
 return role

def create_repository_admin_role ( app , repository ) : sa_session = app . model . context . current name = get_repository_admin_role_name ( str ( repository . name ) , str ( repository . user . username ) ) description = 'A user or group member with this role can administer this repository.' role = app . model . Role ( name = name , description = description , type = app . model . Role . types . SYSTEM ) sa_session . add ( role ) sa_session . flush ( ) app . model . UserRoleAssociation ( repository . user , role ) rra = app . model . RepositoryRoleAssociation ( repository , role ) sa_session . add ( rra ) sa_session . flush ( ) return role
create a new role with name-spaced name based on the repository name and its owners public user name .