Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


 
Returns all protection settings of a protected instance in a remote EDMdatabase.
Related functions: edmiRemoteCheckInstanceAccess, edmiRemoteChangeInstanceOwner edmiRemoteDefineAccessRights, edmiRemoteDeleteAccessRights, edmiRemoteProtectInstance.
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteGetInstanceAccessRights(SdaiServerContext serverContextId,
                                             SdaiInstance      currInst,
                                             SdaiVersion       version,
                                             SdaiInstance      *ownerId,
                                             SdaiInstance      *groupOwnerId,
                                             SdaiUnsignedInt   *protection,
                                             SdaiInstance      **administrators,
                                             SdaiVoid          *accessFor,
                                             SdaiInvocationId  *edmiInvocationId);
 
Arguments:

serverContextId

Context identification, from edmiDefineServerContext

currInst

A numeric instanceID that uniquely identifies a protected instance for which the protection info shall be returned. This instanceId may represent any protected object in the remote EDMdatabase such as models, repositories, schemas and containers.

version

If the <currInst> argument is a modelId, this argument specifies which version of the model to return protection info for. This argument is a sequence number counting from one. For each new version created this number will be incremented by one.

ownerId

Variable that will receive the userId of the EDMuser that owns the protected instance. Will be zero if the protected instance has no owner.

groupOwnerId

Variable that will receive the groupId of the EDMgroup that owns the protected instance. Will be zero if the protected instance has no owner group.

protection

Returnes the full 15bit protection code of the specified protected instance. The value is a bitwise OR of any combination of the symbols listed below.
OWNER_READ, OWNER_WRITE, OWNER_CREATE, OWNER_EXECUTE, OWNER_DELETE, OWNER_NONE, GROUP_READ, GROUP_WRITE, GROUP_CREATE, GROUP_EXECUTE, GROUP_DELETE, GROUP_NONE, PUBLIC_READ, PUBLIC_WRITE, PUBLIC_CREATE, PUBLIC_EXECUTE, PUBLIC_DELETE, PUBLIC_NONE

administrators

Variable that will receive a zero-terminated buffer with a list of all the administrators of the protected instance. Administrators may be both EDMusers and EDMgroups.

accessFor

zero-terminated buffer of userIds and/or groupIds, each combined with their individually set 5bit access rights code. The access rights code is a bitwise OR of any combination of the symbols below:
DELETE_ACCESS, EXECUTE_ACCESS, CREATE_ACCESS, WRITE_ACCESS, READ_ACCESS

edmiInvocationId

Currently not used.

Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an _EDMinterface_ error code. Use edmiGetErrorText to get the error text corresponding to the error code.
Example:
EdmiError rstat;
SdaiServerContext myContext;
SdaiRepository repId;
SdaiModel modId;
SdaiInteger protCode;
SdaiInstance *pAdmin, owner, groupOwner, directorId;
struct {
SdaiInstance Id; 
SdaiInteger Code; 
} *pAccessFor;
 
/* Define Remote Server Context */
rstat = edmiDefineServerContext("MyRemoteServerContext",
"Superuser", NULL, "cf37ftr", 
"TCP", "9090", "MyServerHost", 
NULL, NULL, NULL, NULL, NULL, &myContext); 
 
/* Get Johnnys hour list model */
rstat = edmiRemoteGetUser(myContext, "Director", &directorId, NULL);
rstat = edmiRemoteGetRepository(myContext, "StaffRepository",
&repId, NULL); 
rstat = edmiRemoteGetModel(myContext, repId,
"JohnnysHourList", &modId, NULL); 
 
/* Get all protection info */
rstat = edmiRemoteGetInstanceAccessRights(myContext, modId, 0,
&owner, &groupOwner, &protCode,  
&pAdmin, &pAccessFor, NULL); 
 
/* Remove Directors individually set access */
while(pAccessFor->Id) {
if (pAccessFor->Id == directorId) { 
rstat = edmiRemoteDeleteAccessRights(myContext,  
modId, directorId, NULL); 
break; 

++pAccessFor; 
}
. . .

  • No labels