1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 SAF_Role *
 saf_declare_role(SAF_ParMode pmode,                     /* The parallel mode */
                  SAF_Db *db,                            /* The database in which to create the new role */
                  const char *name,                      /* Name of the role */
                  const char *url,                       /* An optional URL to the role documentation */
                  SAF_Role *role                         /* [OUT] Optional role handle to initialize (and return) */
                  )
 {
     SAF_ENTER(saf_declare_role, NULL);
     ss_scope_t          topscope;

     if (!_saf_is_participating_proc(pmode)) SAF_RETURN(NULL);
     ss_file_topscope(db, &topscope);
     role = (ss_role_t*)ss_pers_new(&topscope, SS_MAGIC(ss_role_t), NULL, SAF_ALL==pmode?SS_ALLSAME:0U, (ss_pers_t*)role, NULL);

     if (SAF_EACH==pmode) SS_PERS_UNIQUE(role);
     ss_string_set(SS_ROLE_P(role,name), name);
     ss_string_set(SS_ROLE_P(role,url), url);

     SAF_LEAVE(role);
 }