Create permission request

        The call is idempotent; that is, if one posts the same pos_id and
        pos_tid twice, only one Permission request is created.
114
def create_permission_request(self, customer, pos_id, pos_tid, scope,
                                  ledger=None, text=None, callback_uri=None,
                                  expires_in=None):
        
        arguments = {'customer': customer,
                     'pos_id': pos_id,
                     'pos_tid': pos_tid,
                     'scope': scope,
                     'ledger': ledger,
                     'text': text,
                     'callback_uri': callback_uri,
                     'expires_in': expires_in}
        return self.do_req('POST',
                           self.merchant_api_base_url + '/permission_request/',
                           arguments).json()
222961
def set(self, name, permission):
        
        assert isinstance(permission, BasePermission), 'Only permission instances can be added to the set'

        self._permissions[name] = permission
50756
public Permission createPermission(final String name, final String description) {
        pm.currentTransaction().begin();
        final Permission permission = new Permission();
        permission.setName(name);
        permission.setDescription(description);
        pm.makePersistent(permission);
        pm.currentTransaction().commit();
        return getObjectById(Permission.class, permission.getId());
    }
256234
def create_single_poll_submission(self, poll_id, poll_session_id, poll_submissions_poll_choice_id):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - poll_id
        """ID"""
        path["poll_id"] = poll_id

        # REQUIRED - PATH - poll_session_id
        """ID"""
        path["poll_session_id"] = poll_session_id

        # REQUIRED - poll_submissions[poll_choice_id]
        """The chosen poll choice for this submission."""
        data["poll_submissions[poll_choice_id]"] = poll_submissions_poll_choice_id

        self.logger.debug("POST /api/v1/polls/{poll_id}/poll_sessions/{poll_session_id}/poll_submissions with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("POST", "/api/v1/polls/{poll_id}/poll_sessions/{poll_session_id}/poll_submissions".format(**path), data=data, params=params, no_data=True)
71885
public void requestAfterExplanation(@NonNull String[] permissions) {
        ArrayList<String> permissionsToRequest = new ArrayList<>();
        for (String permissionName : permissions) {
            if (isPermissionDeclined(permissionName)) {
                permissionsToRequest.add(permissionName); // add permission to request
            } else {
                permissionCallback.onPermissionPreGranted(permissionName); // do not request, since it is already granted
            }
        }
        if (permissionsToRequest.isEmpty()) return;
        permissions = permissionsToRequest.toArray(new String[permissionsToRequest.size()]);
        context.requestPermissions(permissions, REQUEST_PERMISSIONS);
    }
276154
@Override
    public IPermission newPermission(String owner, IAuthorizationPrincipal principal) {
        IPermission p = getPermissionStore().newInstance(owner);
        if (principal != null) {
            String pString = getPrincipalString(principal);
            p.setPrincipal(pString);
        }
        return p;
    }
962299
def create(self, dcid, ip_type, params=None):
        ''' 
        '''
        params = update_params(params, {
            'DCID': dcid,
            'ip_type': ip_type
        })
        return self.request('/v1/reservedip/create', params, 'POST')
685666
private void initPermissionsForPrincipal(JsonEntityBean principal) {
        permissions.add(
                principal.getTypeAndIdHash()
                        + "_"
                        + PortletAdministrationHelper.PortletPermissionsOnForm.BROWSE
                                .getActivity());
        permissions.add(
                principal.getTypeAndIdHash()
                        + "_"
                        + PortletAdministrationHelper.PortletPermissionsOnForm.SUBSCRIBE
                                .getActivity());
    }
1285471
public ResponseBuilder withAskForPermissionsConsentCard(List<String> permissions) {
        this.card = AskForPermissionsConsentCard.builder()
                .withPermissions(permissions)
                .build();
        return this;
    }
454737
def has_permission(self, request, extra_permission=None):
        
        permission = request.user.is_active and request.user.is_staff
        if extra_permission:
            permission = permission and request.user.has_perm(extra_permission)
        return permission
1166927
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_add_post(obj, user)
452110
public CreateResponse create(CreateRequest request) {
    return call(
      new PostRequest(path("create"))
        .setParam("name", request.getName())
        .setParam("organization", request.getOrganization()),
      CreateResponse.parser());
  }
273745
public function create_item_permissions_check( $request ) {

		$post_type = get_post_type_object( $this->post_type );

		if ( ! empty( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( $post_type->cap->edit_others_posts ) ) {
			return new WP_Error( 'rest_cannot_edit_others', __( 'You are not allowed to create posts as this user.' ), array( 'status' => rest_authorization_required_code() ) );
		}

		if ( ! empty( $request['sticky'] ) && ! current_user_can( $post_type->cap->edit_others_posts ) ) {
			return new WP_Error( 'rest_cannot_assign_sticky', __( 'You do not have permission to make posts sticky.' ), array( 'status' => rest_authorization_required_code() ) );
		}

		if ( ! current_user_can( $post_type->cap->create_posts ) ) {
			return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create new posts.' ), array( 'status' => rest_authorization_required_code() ) );
		}
		return true;
	}
1064256
def perform_create(self, serializer):
        """"""
        with transaction.atomic():
            instance = serializer.save()

            # Assign all permissions to the object contributor.
            assign_contributor_permissions(instance)
86699
public function giveRolePermission(int $role_id, string $permission_name, bool $inverse)
    {

        $role = $this->getRole($role_id);

        $permission = PermissionModel::firstOrNew([
            'title' => $permission_name,
        ]);

        // If the role does not already have the permission
        // add it. We will also apply the inverse rule as an
        // extra attribute on save()
        if (! $role->permissions->contains($permission->id))
            $role->permissions()->save($permission, ['not' => $inverse]);

    }
1195850
def create_call(self, raw_request, **kwargs):
        """"""
        req = self.create_request(raw_request, **kwargs)
        res = self.create_response(**kwargs)
        rou = self.create_router(**kwargs)
        c = self.call_class(req, res, rou)
        return c
772921
public static function create($phone_number, $first_name, $last_name, $user_id, $vcard = null)
    {
        return new self($phone_number, $first_name, $last_name, $user_id, $vcard);
    }