...
Code Block | ||||
---|---|---|---|---|
| ||||
EdmiError edmiRemoteDeleteGroupBN(SdaiServerContext serverContextId,
SdaiString groupName,
SdaiInvocationId *edmiInvocationId);
|
Deletes an EDMgroup identified by its name from a remote EDMdatabase
...
.
...
An EDMgroup may not be deleted as long as an EDMuser is connected to the remote EDMserver
...
with this EDMgroup account. Neither may an EDMgroup be deleted if any data in the database have the actual EDMgroup to be deleted as the owner group.
...
Only the superuser may use this function.
...
Arguments
...
Type | Name | Comment |
SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
SdaiString | groupName | The name of the EDMgroup to be deleted. |
SdaiInvocationId | edmiInvocationId | Currently not used. |
...
Return Value
...
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Options
...
Example
...
Code Block | ||
---|---|---|
| ||
/* Delete the Group 'Guest' and Give all objects owned by 'Guest' to group 'Friend'. */ EdmiError rstat; SdaiServerContext suContext; /* Define Remote Server Context for the superuser */ rstat = edmiDefineServerContext("SuperUserContext", |
...
"superuser", NULL, "xfx56kl9", |
...
"TCP", "9090", "MyServerHost", |
...
NULL, NULL, NULL, NULL, NULL, &suContext); |
...
/* Try to delete group 'Guest' */ |
...
rstat = edmiRemoteDeleteGroupBN(suContext, "Guest", NULL); |
...
if (rstat == edmiE_GROUP_OWNS) { |
...
/* 'Guest' may not own objects when deleted. |
...
Must locate an object owned by 'Guest'. */ |
...
SdaiAggr _instAggr; |
...
SdaiModel _instId; |
...
SdaiInteger _index, _nInst, _nTot; |
...
SdaiUser _guestGroupId, _friendGroupId; |
...
/* Get the 'Guest' group Id */ |
...
rstat = edmiRemoteGetGroup(suContext, "Guest", &_guestGroupId, NULL); |
...
/* Get all edm_models from the ExpressDataManager model */ |
...
rstat = edmiRemoteGetEntityExtentBN(suContext, "SystemRepository", |
...
"ExpressDataManager", "EDM_MODEL", 0, |
...
&_instAggr, &_nInst, &_nTot, NULL); |
...
_index = 0; |
...
_nInst = 1; |
...
_instId = 0; |
...
/* Look for models owned by 'Guest' */ |
...
rstat = edmiRemoteFindAggrInstances(suContext, _instAggr, |
...
"GROUP = _guestGroupId", 1, |
...
&_index, &_nInst, &_instId, NULL); |
...
if (!_instId) { |
...
/* 'Guest' owns no models. Get all edm_repositories |
...
from the ExpressDataManager model */ rstat = edmiRemoteGetEntityExtentBN(suContext, "SystemRepository", |
...
"ExpressDataManager", "EDM_REPOSITORY", 0, |
...
&_instAggr, &_nInst, &_nTot, NULL); |
...
_nInst = 1; |
...
/* Look for repositories owned by 'Guest' */ |
...
rstat = edmiRemoteFindAggrInstances(suContext, _instAggr, |
...
"GROUP = _guestGroupId", 1, |
...
&_index, &_nInst, &_instId, NULL); |
...
if (!_instId) { |
...
/* 'Guest' owns no protected objects. Something is wrong. |
...
There is nothing more to be owned by 'Guest' !! */ |
...
printf("ERROR: Can not find object owned by 'Guest'"); |
...
goto err; |
...
} } /* Get the 'Friend' group Id */ |
...
rstat = edmiRemoteGetGroup(suContext, "Friend", &_friendGroupId, NULL); |
...
/* Give all objects owned by 'Guest' to 'Friend' */ |
...
rstat = edmiRemoteChangeInstanceOwner(suContext, _instId, |
...
_friendGroupId, FOR_ALL_OWNED_INSTANCES, NULL); |
...
/* Delete 'Guest' */ |
...
rstat = edmiRemoteDeleteGroup(suContext, _guestGroupId, NULL); |
...
printf("\n'Guest' was deleted. 'Friend' was given ownership \ |
...
to all objects previously owned by 'Guests'"); |
...
}
. . . |
See also
Filter by label (Content by label) | ||||||
---|---|---|---|---|---|---|
|