0 Replies Latest reply on Sep 22, 2007 6:23 AM by Newsgroup_User

    Stuck on roles using cfloginuser and cfcs

    Level 7
      I am attempting to make a login block function for my application. It is
      using NT to authenticate the user using Active Directory. It authenticates
      the user and logs them in, but I have no roles. What am I doing wrong or how
      do I pass the roles back to the page so hey can be used? Thanks for any
      help.

      <cffunction name="authUser" access="public" returntype="string">
      <cfargument name="username" type="string" required="yes">
      <cfargument name="password" type="string" required="yes">
      <cfset username=trim(arguments.username)>
      <cfset password=trim(arguments.password)>
      <cfset domain="avemaria" />
      <cfset authenicated = authenticate(#username#, #password#,
      #domain#)>
      <cfif authenticated.auth eq "YES">
      <cfset success = 1>
      <cfset groups = #authenticated.groups#>
      <cfset userCred = setUserCred(#username#, #password#, #groups#)>
      <cfset setSessions = setSessions(#username#)>
      <cfset result = "success">
      <cfelse>
      <cfset result = "failure">
      <cfset success = 0>
      </cfif>
      <cfset userLog = logUser(#username#, #password#, #success#)>
      <cfreturn result>
      </cffunction>

      <cffunction name="authenticate" access="private" output="false"
      returntype="struct" hint="I authenticate against the NT server">
      <cfargument name="username" type="string" required="yes">
      <cfargument name="password" type="string" required="yes">
      <cfargument name="domain" type="string" required="yes">
      <cfntauthenticate username="#username#" password="#password#"
      domain="#domain#" result="authenticated" listgroups="yes">
      <cfreturn authenticated>
      </cffunction>

      <cffunction name="setUserCred" access="private" output="false"
      returntype="void" hint="I set credentical to cfloginuser">
      <cfargument name="username" type="string" required="yes">
      <cfargument name="password" type="string" required="yes">
      <cfargument name="group" type="string" required="yes">
      <cfloginuser name="#username#" password="#password#"
      roles="#groups#">
      </cffunction>

      --
      Wally Kolcz
      MyNextPet.org
      Founder / Developer
      586.871.4126