huskar_api/extras/auth.py
def authorize_owners(app_info):
    """Grants the authority of application owners.

    The application owners should be authorized to write his (her)
    applications.
    """
    application = app_info.ensure_application()
    now_auth = set([(i.user_id, Authority(i.authority))
                    for i in application.list_auth()])
    need_ensure_owners = set([(user.id, authority)
                              for (user, authority) in ensure_owners(
                                app_info)])
    for user_id, authority in need_ensure_owners.difference(now_auth):
        user = User.get(user_id)
        with huskar_audit_log(action_types.GRANT_APPLICATION_AUTH,
                              user=user, application=application,
                              authority=authority.value):
            application.ensure_auth(authority, user_id)
        logger.info(
            'granting user "%s" to %s application "%s"',
            user.username, authority, application.application_name)
Grants the authority of application owners.

    The application owners should be authorized to write his (her)
    applications.
    
Grants the authority of application owners.
The application owners should be authorized to write his (her)
applications.
Grants the authority of application owners . The application owners should be authorized to write his ( her ) applications .
def authorize_owners(app_info):
    application = app_info.ensure_application()
    now_auth = set([(i.user_id, Authority(i.authority))
                    for i in application.list_auth()])
    need_ensure_owners = set([(user.id, authority)
                              for (user, authority) in ensure_owners(
                                app_info)])
    for user_id, authority in need_ensure_owners.difference(now_auth):
        user = User.get(user_id)
        with huskar_audit_log(action_types.GRANT_APPLICATION_AUTH,
                              user=user, application=application,
                              authority=authority.value):
            application.ensure_auth(authority, user_id)
        logger.info(
            'granting user "%s" to %s application "%s"',
            user.username, authority, application.application_name)
def authorize_owners ( app_info ) : application = app_info . ensure_application ( ) now_auth = set ( [ ( i . user_id , Authority ( i . authority ) ) for i in application . list_auth ( ) ] ) need_ensure_owners = set ( [ ( user . id , authority ) for ( user , authority ) in ensure_owners ( app_info ) ] ) for user_id , authority in need_ensure_owners . difference ( now_auth ) : user = User . get ( user_id ) with huskar_audit_log ( action_types . GRANT_APPLICATION_AUTH , user = user , application = application , authority = authority . value ) : application . ensure_auth ( authority , user_id ) logger . info ( 'granting user "%s" to %s application "%s"' , user . username , authority , application . application_name )
Grants the authority of application owners.
Grants the authority of application owners .
"""Grants the authority of application owners.

    The application owners should be authorized to write his (her)
    applications.
    """
app_info