This is a convenience function that wraps the "authorize group"
        functionality of the C{authorize_security_group} method.

        For an explanation of the parameters, see C{authorize_security_group}.
492658
def authorize_group_permission(
        self, group_name, source_group_name, source_group_owner_id):
        
        d = self.authorize_security_group(
            group_name,
            source_group_name=source_group_name,
            source_group_owner_id=source_group_owner_id)
        return d
339287
def auth_add(name, service, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('auth:group:members:add', **{
        'storage': ctx.repo.create_secure_service('storage'),
        'name': name,
        'service': service,
    })
1275888
def auth_create(name, token, force, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('auth:group:create', **{
        'storage': ctx.repo.create_secure_service('storage'),
        'name': name,
        'token': token,
        'force': force,
    })
1299080
def group(__decorated__, **Config):
  
  """
  _Group = Group(__decorated__, Config)

  if isclass(__decorated__): # convert the method of the class to static methods so that they could be accessed like object methods; ir: g1/t1(...).
    static(__decorated__)

  state.ActiveModuleMemberQ.insert(0, _Group)

  return _Group.Underlying
670074
def _subgroup(group, *args, **kwargs):
    
    def decorator(f):
        f.required = kwargs.pop('required', True)
        if 'parents' in kwargs:
            if not hasattr(f, '_argnames'):  # pragma: no cover
                f._argnames = []
            for p in kwargs['parents']:
                f._argnames += p._argnames if hasattr(p, '_argnames') else []
            kwargs['parents'] = [p.parser for p in kwargs['parents']]
        if 'help' not in kwargs:
            kwargs['help'] = f.__doc__
        if args == ():
            f.parser = group._subparsers.add_parser(f.__name__, **kwargs)
        else:
            f.parser = group._subparsers.add_parser(*args, **kwargs)
        f.parser.set_defaults(**{'_func_' + group.__name__: f})
        f.climax = True
        for arg in getattr(f, '_arguments', []):
            f.parser.add_argument(*arg[0], **arg[1])
        f._subparsers = f.parser.add_subparsers()
        f.command = partial(_subcommand, f)
        f.group = partial(_subgroup, f)
        return f
    return decorator
583900
def get_securitygroup(self, group_id, **kwargs):
        
        if 'mask' not in kwargs:
            kwargs['mask'] = (
                'id,'
                'name,'
                'description,'
                '''rules[id, remoteIp, remoteGroupId,
                         direction, ethertype, portRangeMin,
                         portRangeMax, protocol, createDate, modifyDate],'''
                '''networkComponentBindings[
                    networkComponent[
                        id,
                        port,
                        guest[
                            id,
                            hostname,
                            primaryBackendIpAddress,
                            primaryIpAddress
                        ]
                    ]
                ]'''
            )

        return self.security_group.getObject(id=group_id, **kwargs)
1304042
def create_security_group(self, name, desc=None):
        '''
        
        '''
        body = {'security_group': {'name': name,
                                   'description': desc}}
        return self.network_conn.create_security_group(body=body)
505913
public static Object invokeAccessibly(Object instance, Method method, Object[] parameters) {
      return SecurityActions.invokeAccessibly(instance, method, parameters);
   }
297029
def authorize(self, ctx, identity, ops):
        '''
        '''
        allowed = []
        caveats = []
        for op in ops:
            ok, fcaveats = self._f(ctx, identity, op)
            allowed.append(ok)
            if fcaveats is not None:
                caveats.extend(fcaveats)
        return allowed, caveats
1086639
def authorize(self, ctx, identity, ops):
        '''
        '''
        if len(ops) == 0:
            # Anyone is allowed to do nothing.
            return [], []
        allowed = [False] * len(ops)
        has_allow = isinstance(identity, ACLIdentity)
        for i, op in enumerate(ops):
            acl = self._get_acl(ctx, op)
            if has_allow:
                allowed[i] = identity.allow(ctx, acl)
            else:
                allowed[i] = self._allow_public and EVERYONE in acl
        return allowed, []
169975
def requires_auth(self, func):
        '''
        
        '''
        @wraps(func)
        def decorated(*args, **kwargs):
            ''' Wrapper '''
            auth = request.authorization
            if not auth or not self.check_auth(auth.username, auth.password):
                return self.authenticate()
            return func(*args, **kwargs)
        return decorated
1302472
def create_auth_group(sender, instance, created, **kwargs):
    
    if created:
        AuthGroup.objects.create(group=instance)
866122
def requires_public_key(func):
    

    def func_wrapper(self, *args, **kwargs):
        if hasattr(self, "public_key"):
            func(self, *args, **kwargs)
        else:
            self.generate_public_key()
            func(self, *args, **kwargs)

    return func_wrapper
912465
def get_secgroup_id(kwargs=None, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The get_secgroup_id function must be called with -f or --function.'
        )

    if kwargs is None:
        kwargs = {}

    name = kwargs.get('name', None)
    if name is None:
        raise SaltCloudSystemExit(
            'The get_secgroup_id function requires a \'name\'.'
        )

    try:
        ret = list_security_groups()[name]['id']
    except KeyError:
        raise SaltCloudSystemExit(
            'The security group \'{0}\' could not be found.'.format(name)
        )

    return ret
647394
def authenticated_users(func):
    
    is_object_permission = "has_object" in func.__name__

    @wraps(func)
    def func_wrapper(*args, **kwargs):
        request = args[0]
        # use second parameter if object permission
        if is_object_permission:
            request = args[1]

        if not(request.user and request.user.is_authenticated):
            return False

        return func(*args, **kwargs)

    return func_wrapper
22922
def auth_list(**kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('auth:group:list', **{
        'storage': ctx.repo.create_secure_service('storage'),
    })
304261
def from_callable(cls, func, ignored_parameters=set()):
        
        group = cls()
        signature = inspect.signature(func)
        for parameter in signature.parameters.values():
            if parameter.name.startswith('_') or parameter.name in ignored_parameters:
                continue
            parameter = Parameter.from_callable_parameter(parameter)
            group[parameter.name] = parameter
        return group