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 »


 
Changes the owner of a protected instance>.
An instance owner may be an EDMuser or an EDMgroup. EDMusers are denoted owners. EDMgroups are denoted owner groups.
Any protected instance may be owned by an EDMuser and/or an EDMgroup. By default, that will be the EDMuser/EDMgroup that initially created the instance. Ownership may be granted to any new EDMuser and/or EDMgroup by superuser.
If the database is created with EXTENDED_ACCESS_CHECKING, changing the owner/owner group of an instance, will also cause the owner/owner group to be added to the list of instance administrators.
Only the superuser may change ownership of instances.
 
Header:
#include "sdai.h"
Prototype:
EdmiError edmiChangeInstanceOwner(SdaiAppInstance currInst,
                                  SdaiInstance    userORgroupId,
                                  SdaiUnsignedInt options);
Arguments:

CurrInst

A numeric instanceID that uniquely identifies an instance in the EDMdatabase that for which owner is to be changed. This instanceID is defined when the actual instance is created by the sdaiCreateInstance or sdaiCreateInstanceBN operation.

UserORgroupId

A numeric instanceID that uniquely identifies the EDMuser or EDMgroup instance in the EDMdatabase that defines the owner of the instance.

Options

Specifies the options to be used in the invocation of the edmiChangeInstanceOwner function. The <options> value can be specified as a bitwise OR between the actual options to enable. All option names are defined in the header file sdai.h .
See detailed descriptions of the available options below.

Option Description

FOR_ALL_OWNED_INSTANCES

 

REMOVE_AS_ADMINISTRATOR

Remove the EDMuser or EDMgroup from the list of administrators.

UNSET_OWNER

Unset the instance owner attribute

UNSET_OWNER_GROUP

Unset the instance owner group attribute

SET_OWNER

Set the given EDMuser as instance owner.

SET_OWNER_GROUP

Set the given EDMgroup as instance owner group.

REPLACE_CURRENT

Replace the existing owner/owner group with the given EDMuser/EDMgroup.

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;
SdaiModel modId;
SdaiUser myUserId;
. . .
if (modId = edmiGetModelBN("myRepository", "myModel")) {
edmiGetMyUserId(&myuserId);
edmiChangeMyUserBN("superuser", "", pwd, &message, &sesskey);
if (rstat = edmiChangeInstanceOwner(modId, myUserId,
SET_OWNER | REPLACE_CURRENT)) {
/* Error in operation */ 
printf("\nError in edmiChangeInstanceOwner: %s", 
edmiGetErrorText(rstat)); 
goto error; 

 
. . .

  • No labels