Skip to content

Commit

Permalink
Merge pull request #54 from UWIT-IAM/gwsAttribute
Browse files Browse the repository at this point in the history
Added a new groups attribute, hidden for now.
  • Loading branch information
mar235av authored Dec 18, 2024
2 parents 1707644 + a8c213d commit 497589d
Showing 3 changed files with 48 additions and 3 deletions.
3 changes: 2 additions & 1 deletion attribute.xml
Original file line number Diff line number Diff line change
@@ -17,7 +17,8 @@
<Attribute id="eppnNameId" description="&lt;i&gt;uwnetid&lt;/i&gt;@washington.edu" authorizingGroup="u_weblogin_admins" type="nameid" />
<Attribute id="ePTID" description="The persistent id as a SAML1 targeted id" authorizingGroup="u_weblogin_admins" type="attribute" />
<Attribute id="givenName" description="Based on preferred name parts (first, middle) if available, else PDS: uwPersonRegisteredFirstMiddle" authorizingGroup="u_weblogin_admins" type="attribute" />
<Attribute id="gws_groups" description="GWS group effective memberships" authorizingGroup="u_weblogin_admins" type="attribute" />
<Attribute id="gws_groups" description="GWS group effective memberships with scope prefix" authorizingGroup="u_weblogin_admins" type="attribute" />
<Attribute id="gws_groups_unscoped" description="GWS group effective memberships without scope prefix" authorizingGroup="u_weblogin_admins" type="attribute" />
<Attribute id="homedept" description="Home department (PDS: uwEmployeeHomeDepartment)" authorizingGroup="u_weblogin_admins" type="attribute" />
<Attribute id="idNameId" description="&lt;i&gt;uwnetid&lt;/i&gt;" authorizingGroup="u_weblogin_admins" type="nameid" />
<Attribute id="mailstop" description="Mail stop (PDS: uwEmployeeMailstop)" authorizingGroup="u_weblogin_admins" type="attribute" />
24 changes: 24 additions & 0 deletions src/main/webapp/WEB-INF/velocity/browser/attr_req.vm
Original file line number Diff line number Diff line change
@@ -93,6 +93,7 @@ Check the attributes you need. Uncheck those you no longer want.
#set ( $chk = '' )
#set ( $dis = '' )
#set ( $grps='')
#set ( $grps_unscoped='')
#set ( $reqhide = '')
#if (${attr.attributeFilterPolicy})
#set ($ar = $attr.attributeRule )
@@ -109,6 +110,17 @@ Check the attributes you need. Uncheck those you no longer want.
#end
#end ## vrules
#end ## if
#if ($attr.id == 'gws_groups_unscoped')
#set ( $nl='')
#foreach ( $r in ${ar.valueRules} )
#foreach ( $v in ${r.rules} )
#set ($grps_unscoped = $grps_unscoped + $nl + ${v.getValue()} )
#set ($nl='
')
#end
#end ## vrules
#end ## if

#else
#if ($attr.reqHidden) #set ($reqhide = $hide) #end
#end ## afp
@@ -117,6 +129,9 @@ Check the attributes you need. Uncheck those you no longer want.
$chk $dis value="${attr.id}"
#if ($attr.id == 'gws_groups')
onChange="local_check_gws()"
#end
#if ($attr.id == 'gws_groups_unscoped')
onChange="local_check_gws_unscoped()"
#end
class="attr_req_chk" aria-label="${attr.id}"/>
</div>
@@ -133,6 +148,15 @@ Check the attributes you need. Uncheck those you no longer want.
<textarea data-dojo-type="dijit.form.Textarea" id="attr_req_gws_text_in" $hide >#X($grps)</textarea>
</div>
#end
#if ($attr.id == 'gws_groups_unscoped')
<br>
<div id="attr_req_gws_unscoped_text_tr" #if ($grps_unscoped!='')#else $hide #end>
<label for="attr_req_gws_unscoped_text">Which groups?$rstar</label><br>
<textarea style="font-size:smaller" data-dojo-type="dijit.form.Textarea"
id="attr_req_gws_unscoped_text" rows="2" cols="40" aria-label="which groups, required">#X($grps_unscoped)</textarea>
<textarea data-dojo-type="dijit.form.Textarea" id="attr_req_gws_unscoped_text_in" $hide >#X($grps_unscoped)</textarea>
</div>
#end
</div>
</li>

24 changes: 22 additions & 2 deletions src/main/webapp/js/sp-2.6.1.js
Original file line number Diff line number Diff line change
@@ -926,6 +926,13 @@ function local_check_gws() {
else iam_hideShow(['attr_req_gws_text_tr'],[]);
}

function local_check_gws_unscoped() {
ck = dijitRegistry.byId('attr_req_gws_groups_unscoped').get('checked');
console.log('ck='+ck);
if (ck) iam_hideShow([],['attr_req_gws_unscoped_text_tr']);
else iam_hideShow(['attr_req_gws_unscoped_text_tr'],[]);
}

var _okmsg;

function _postReqAttrs() {
@@ -938,7 +945,9 @@ function attr_requestAttrs(entityId) {

_okmsg = '';
var gws_text = '';
var gws_unscoped_text = '';
var grps = dijitRegistry.byId('attr_req_gws_text').get('value').trim();
var grps_unscoped = dijitRegistry.byId('attr_req_gws_unscoped_text').get('value').trim();
alist = dojoQuery('.attr_req_chk');
xml = '<Attributes>';
for (a=0; a<alist.length; a++) {
@@ -959,8 +968,19 @@ function attr_requestAttrs(entityId) {
}
xml += '<Add id="' + aid + '"/>';
_okmsg += '<li>Adding: ' + aid + '</li>';
gws_text = '\n\nGroups requested:\n' + grps;
gws_text = '\n\nGroups (scoped) requested:\n' + grps;
if (grpsin!='') gws_text += '\nPrevious groups:\n' + grpsin;
} else if (aid=='gws_groups_unscoped') {
var grps_unscoped_in = dijitRegistry.byId('attr_req_gws_unscoped_text_in').get('value').trim();
if (grps_unscoped==grps_unscoped_in) continue;
if (grps_unscoped=='') {
iam_showTheNotice('You must identify the groups you need.');
return;
}
xml += '<Add id="' + aid + '"/>';
_okmsg += '<li>Adding: ' + aid + '</li>';
gws_unscoped_text = '\n\nGroups (unscoped) requested:\n' + grps_unscoped;
if (grps_unscoped_in!='') gws_unscoped_text += '\nPrevious groups:\n' + grps_unscoped_in;
} else if (inn.value=='') {
xml += '<Add id="' + aid + '"/>';
_okmsg += '<li>Adding: ' + aid + '</li>';
@@ -982,7 +1002,7 @@ function attr_requestAttrs(entityId) {
iam_showTheNotice('You must explain why you need the attributes');
return;
}
xml = xml + '<Comments>' + iam_makeOkXml(msg+gws_text) + '</Comments>';
xml = xml + '<Comments>' + iam_makeOkXml(msg+gws_text+gws_unscoped_text) + '</Comments>';
xml = xml + '</Attributes>';
action = v_root + v_vers + '/rp/attrReq?id=' + entityId + '&xsrf=' + v_xsrf + adminQS;
iam_putRequest(action, null, xml, null, _postReqAttrs);

0 comments on commit 497589d

Please sign in to comment.