edmiRemoteDeleteUserBN


 

EdmiError edmiRemoteDeleteUserBN(SdaiServerContext serverContextId,
                                   SdaiString        userName, 
                                   SdaiInvocationId  *edmiInvocationId); 

Deletes an EDMuser identified by its name from a remote EDMdatabaseAn EDMuser may not be deleted when it is connected to an EDMserver Neither may it be deleted if it is the owner of data in the remote EDMdatabase. Only the superuser may use this function.

Arguments


TypeNameComment
 SdaiServerContext

serverContextId

Context identification, from edmiDefineServerContext

 SdaiString

userName

The name of the EDMuser to be deleted.

 SdaiInvocationId

edmiInvocationId

Currently not used.

Return Value


Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_r_EDMInterface'.

 

Options


  

 

Example


 

 /* Delete User 'Lucy' and Give
 all Lucys objects to Johnny. */ 
 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 'Lucy' */
 rstat = edmiRemoteDeleteUserBN(suContext, "Lucy", NULL);
 if (rstat == edmiE_USER_OWNS) {
 /* Lucy may not own objects when deleted. 
 Must locate an object owned by Lucy. */ 
 SdaiAggr _instAggr; 
 SdaiModel _instId; 
 SdaiInteger _index, _nInst, _nTot; 
 SdaiUser _lucyUserId, _johnnyUserId; 
  
 /* Get the 'Lucy' user Id */ 
 rstat = edmiRemoteGetUser(suContext, "Lucy", &_lucyUserId, 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 'Lucy' */ 
 rstat = edmiRemoteFindAggrInstances(suContext, _instAggr,  
 "OWNER = _lucyUserId", 1,  
 &_index, &_nInst, &_instId, NULL);  
 if (!_instId) { 
 /* Lucy 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 'Lucy' */ 
 rstat = edmiRemoteFindAggrInstances(suContext, _instAggr,  
 "OWNER = _lucyUserId", 1,  
 &_index, &_nInst, &_instId, NULL);  
 if (!_instId) { 
 /* Lucy owns no protected objects. Something is wrong. 
 There is nothing more to be owned by Lucy !! */  
 printf("ERROR: Can not find object owned by Lucy"); 
 goto err; 
 } 
 } 
 /* Get the 'Johnny' user Id */ 
 rstat = edmiRemoteGetUser(suContext, "Johnny", &_johnnyUserId, NULL); 
  
 /* Give all objects owned by Lucy to Johnny */ 
 rstat = edmiRemoteChangeInstanceOwner(suContext, _instId,  
 _johnnyUserId, FOR_ALL_OWNED_INSTANCES, NULL); 
  
 /* Delete Lucy */ 
 rstat = edmiRemoteDeleteUser(suContext, _lucyUserId, NULL); 
 printf("\nLucy was deleted. Johnny was given ownership \ 
 to all Lucys objects"); 
 }
 . . .

 

See also

Filter by label

There are no items with the selected labels at this time.