Set access permissions for the site landing.site.setRights

We are still updating this page

Some data may be missing here — we will complete it shortly.

Scope: landing

Who can execute the method: administrator

The method landing.site.setRights sets access permissions for the site. It will return true or an error. The method is available only to the portal administrator, and in the cloud, it is also limited to paid plans.

Parameters

Parameter

Description

id
unknown

Site identifier.

rights
unknown

An object with permissions, where the keys are unique identifiers (user, department, group, ...), and the values are allowed operations:

  • denied – access denied
  • read – read
  • edit – edit (page content)
  • sett – change settings
  • public – publish
  • delete – delete (to trash, and restore from trash)

Permissions are independent and can be granted selectively. For example, a user may have only the right to publish without the ability to make any changes.

The following values can be used as keys:

  • SG - workgroup
  • U - user
  • DR - department, including subdivisions
  • UA - all authorized users
  • G - user group

Examples

try
        {
        	const response = await $b24.callMethod(
        		'landing.site.setRights',
        		{
        			id: 645,
        			rights: {
        				'U3': [
        					'edit', 'delete'
        				],
        				'U1': [
        					'edit', 'sett'
        				]
        			}
        		}
        	);
        	
        	const result = response.getData().result;
        	console.info(result);
        }
        catch(error)
        {
        	console.error(error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'landing.site.setRights',
                    [
                        'id'     => 645,
                        'rights' => [
                            'U3' => ['edit', 'delete'],
                            'U1' => ['edit', 'sett'],
                        ],
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
            // Your required data processing logic
            processData($result);
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error setting site rights: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'landing.site.setRights',
            {
                id: 645,
                rights: {
                    'U3': [
                        'edit', 'delete'
                    ],
                    'U1': [
                        'edit', 'sett'
                    ]
                }
            },
            function(result)
            {
                if(result.error())
                {
                    console.error(result.error());
                }
                else
                {
                    console.info(result.data());
                }
            }
        );
        

How to Use Examples in Documentation